﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            string text1 = textBox1.Text.ToString();
            string text2 = textBox2.Text.ToString();
        
            UsersAndPoWOrAllAdd usersAndPoWOrAllAdd = new UsersAndPoWOrAllAdd();
            var us =string.Format ("select *from Users where UserName='{0}' and PassWord='{1}'",text1,text2);
            var dt = usersAndPoWOrAllAdd.GetDataTable(us);
            if (dt.Rows.Count==1)
            {//打开窗口2
                MessageBox.Show("登陆成功", "提示");
                form2.Show();
                this.Hide();
                
                
               
                
            }




        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form3 form3 = new Form3();
            form3.Show();
            this.Hide();
        }
    }
}
